#!/usr/bin/python3
# author luke
# 2024年03月06日下午 12:10

class Solution(object):
    def runningSum(self, nums):
        """
        :type nums: List[int]
        :rtype: List[int]
        """
        sum_nums = [0] * len(nums)
        for i in range(len(nums)):
            sum_nums[i] = sum_nums[i - 1] + nums[i]  # 注意i=0,sum_nums[ - 1]=0,这道题无所谓，以后做题要注意数组下标

        return sum_nums


if __name__ == '__main__':
    # nums = [1, 2, 3, 4]
    # sou = Solution()
    # print(sou.runningSum(nums))

    test_cases = [
        ([1, 2, 3, 4], [1, 3, 6, 10]),
        ([1, 1, 1, 1, 1], [1, 2, 3, 4, 5]),
        ([3, 1, 2, 10, 1], [3, 4, 6, 16, 17])
    ]

    sou = Solution()
    for nums, expected in test_cases:
        result = sou.runningSum(nums)
        print(f"输入：{nums}输出：{result}期望输出：{expected}")
